import { getCategoryLis, reqBannerList, reqFloorList } from '@/api'
export default {
  state: {
    data: [],
    bannerList: [],
    floorList: [],
  },
  mutations: {
    SET_DATA(state, data) {
      state.data = data
    },
    SET_BANNERLIST(state, bannerList) {
      state.bannerList = bannerList
    },
    SET_FLOORLIST(state, floorList) {
      state.floorList = floorList
    },
  },
  actions: {
    async reqCategoryLis({ commit }) {
      let result = await getCategoryLis()
      if (result.code === 200) {
        commit('SET_DATA', result.data.slice(0, 15))
      }
      // console.log(result)
    },
    async getBannerList({ commit }) {
      let result = await reqBannerList()
      if (result.code === 200) {
        commit('SET_BANNERLIST', result.data)
      }
      // console.log(result)
    },
    async getFloorList({ commit }) {
      let result = await reqFloorList()
      if (result.code === 200) {
        commit('SET_FLOORLIST', result.data)
      }
      // console.log(result)
    },
  },

  getters: {},
}
